package com.gsnd.gsnd22estore.service.impl;

import com.fasterxml.jackson.databind.annotation.JsonAppend;
import com.gsnd.gsnd22estore.domain.EsBook;
import com.gsnd.gsnd22estore.dto.BookDto;
import com.gsnd.gsnd22estore.mapper.EsBookMapper;
import com.gsnd.gsnd22estore.service.BookService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.PathVariable;

import java.util.List;

@Service
public class BookServiceImpl implements BookService {
    //引入dao层
    @Autowired
    EsBookMapper bookMapper;
    @Override
    public List<BookDto> getBookList() {
        return bookMapper.selectList();
    }

    @Override
    public List<BookDto> getBookListByCategory(Integer categoryId) {
        return bookMapper.selectAllByCategoryId(categoryId);
    }

    @Override
    public List<BookDto> getBookListByCondition(String query) {
        return bookMapper.selectAllByKeyword(query);
    }

    @Override
    public EsBook getBookById(Integer id) {
        return bookMapper.selectByIdEsBook(id);
    }


}
